<template>
	<div v-show="showPage">
		<div style="border-bottom: 1px solid #ddd;">
			<h3>汇总报表预览</h3>
		</div>
		<div style="width: 100%;margin-top: 10px;margin-left: 10px;">
			<SummaryReportComponent :componentModel="componentModel" :previewMode="true" ref="summaryReportComponent"></SummaryReportComponent>
		</div>
	</div>
</template>

<script>
	import SummaryReportComponent from '@/components/SummaryReportComponent.vue';
	import restUtil from '@/utils/restUtil.js';
	export default {
		name: "SummaryReportPreviewPage",
		components:{SummaryReportComponent},
		props: ["scope"],
		data() {
			return {
				showPage: false,
				summaryReportRowList:[],
				componentModel:{},
			}
		},
		methods: {
			init() {
				var that = this;
				var data = {
					"json": JSON.stringify(this.scope)
				};
				restUtil.post(this,"summaryreportdesigner/initReportPreviewPage", data).then(
					function(response) {
						if (response.data.code == 1) {
							that.$refs.summaryReportComponent.setSummaryReportModel(response.data.summaryReportModel);
						} else {
							that.$alert(response.data.message, '提示')
						}
					});
			},
			setVisible(visible) {
				this.showPage = visible;
				if (visible) {
					this.init();
				}
			},
			getReturnData() {
				return {};
			},
			getPreviousPage() {
				return "summaryReportConfigPage";
			},
			getNextPage() {
				return undefined;
			},
			isCompletedPage() {
				return true;
			}
		},
	}
</script>

<style>
</style>
